<?php
class posts_controller {
  function index() {
    $post = new Post();
    pass_var('posts',$post->find_all());
  }
  function show() {
    global $runtime;
    $post = new Post($runtime['ident']);
    pass_var('post',$post);
  }
  function write() {}
  function save() {
    $post = new Post($_POST);
    $post->save();
    redirect("posts/show/$post->id");
  }
  function save_comment() {
    global $runtime;
    $comment = new Comment($_POST);
    $comment->post_id = $runtime['ident'];
    $comment->save();
    redirect("posts/show/$comment->post_id");
  }
}
?>